<!--
 * @Author: your name
 * @Date: 2020-08-27 14:44:22
 * @LastEditTime: 2021-01-11 18:03:49
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \MKK开发\html\login\index.html
-->
<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <link rel="stylesheet" href="./css/bui.css">
    <link rel="stylesheet" href="./css/main.css">
    <link rel="stylesheet" type="text/css" href="./css/swiper.min.css" />
    <link rel="stylesheet" href="./css/login.css">
</head>

<body id="login">
    <div id="app" class="bui-page">
        <div id="page_register" class="page">
            <div class="order-head">
                <div class="order-head-text">
                    <div class="text change_luange_in">抖信注册</div>
                    <div class="head-text-right" v-if="is_zh == 1" @click="is_zh = 2;">邮箱注册</div>
                    <div class="head-text-right" v-if="is_zh == 2" @click="is_zh = 1;">手机注册</div>
                </div>
            </div>
            <div class="login-content-wrap">
                <div class="login-title" v-if="is_zh == 1">手机号</div>
                <div class="login-inp-wrap" v-if="is_zh == 1">
                    <input type="text" v-model="phone" class="content-iup" placeholder="请输入您的手机号">
                </div>
                <div class="login-title" v-if="is_zh == 2">邮箱</div>
                <div class="login-inp-wrap" v-if="is_zh == 2">
                    <input type="text" v-model="phone" class="content-iup" placeholder="请输入您的邮箱">
                </div>
                <div class="zc-login-title">登录密码</div>
                <div class="login-ms">密码必须至少6-20字母，需包含字母和数字</div>
                <div class="zc-login-inp-wrap">
                    <input type="password" v-model="dlPassword" class="content-iup" placeholder="请输入登录密码">
                </div>
                <div class="zc-login-inp-wrap">
                    <input type="password" v-model="dlPassword1" class="content-iup" placeholder="请再次输入登录密码">
                </div>
                <div class="zc-login-title">交易密码</div>
                <div class="login-ms">密码必须是六位数字</div>
                <div class="zc-login-inp-wrap">
                    <input type="password" v-model="jyPassword" class="content-iup" placeholder="请输入交易密码">
                </div>
                <div class="zc-login-inp-wrap">
                    <input type="password" v-model="jyPassword1" class="content-iup" placeholder="请再次输入交易密码">
                </div>
                <div class="login-title">邀请码</div>
                <div class="login-inp-wrap">
                    <input type="text" v-model="invite" class="content-iup" placeholder="请输入邀请码">
                </div>
                <div class="login-title">验证码</div>
                <div class="login-inp-wrap flex-lr">
                    <input type="text" v-model="code" class="content-iup" placeholder="请输入验证码">
                    <div style="color: #CA9349; width: 3.2rem; text-align: right" @click="getCode()" v-text="codeText"></div>
                </div>
                <div class="max-btn" style="width: 100%;margin-bottom: 0.32rem;margin-top: 0.92rem" @click="sumbit()">确认注册</div>
                <div class="max-btn" style="width: 100%;margin-bottom: 0.8rem;border: 0.02rem solid #DFBC84;color: #DFBC84;background: #0D0A1B;" @click="goxzdz()">下载APP</div>
            </div>
        </div>
    </div>
    </div>
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/slick.min.js"></script>
    <script src="./js/vue.js"></script>
    <script src="./js/bui.js"></script>
    <script src="./js/md5-min.js"></script>
    <script src="./js/common.js"></script>

    <script type="text/javascript">
        var language_obj = {};
        init_bui();

        function init_bui() {
            var loading = bui.loading()
            var _vue = new Vue({
                el: '#app',
                data: {
                    is_zh: 1,
                    isWaiting: false,
                    selectStatus: true,
                    phone: '', //手机号
                    account: '', //绑定文交所账号
                    code: '', //验证码
                    codeText: '获取验证码', //验证码文字
                    dlPassword: '', //登录密码
                    jyPassword: '', //交易密码
                    dlPassword1: '', //登录密码
                    jyPassword1: '', //交易密码
                    invite: '', //邀请人推荐码
                    on_disable: false,
                },
                created() {
                },
                mounted() {
                    this.invite = window.location.href.split("=")[1];
                },
                methods: {
                    getCode() {
                        var _this = this;
                        if(this.is_zh == 1){
                            if (!this.phone) return $cs.msg('请输入手机号');
                            if (this.isWaiting) return;
                            this.isWaiting = true;
                            var params = {
                                phone: this.phone,
                                type: 1, //1注册 2忘记密码 4-手机号 5-提币
                            };
                            $cs.ajax('login/getVerifyCode',params, function (ret) {
                                if (ret.success == true) {
                                    $cs.msg(ret.data);
                                    _this.remainTime();
                                } else {
                                    _this.isWaiting = false;
                                    $cs.msg(ret.message)
                                }
                            })
                        }else{
                            if (!this.phone) return $cs.msg('请输入邮箱');
                            if (this.isWaiting) return;
                            this.isWaiting = true;
                            var params = {
                                email: this.phone,
                                type: 1, //1注册 2忘记密码 4-手机号 5-提币
                            };
                            $cs.ajax('login/getEmailVerifyCode',params, function (ret) {
                                if (ret.success == true) {
                                    $cs.msg(ret.data);
                                    _this.remainTime();
                                } else {
                                    _this.isWaiting = false;
                                    $cs.msg(ret.message)
                                }
                            })
                        }
                    },
                    remainTime() {
                        var _this = this;
                        var time = 120;
                        var interval = setInterval(function () {
                            _this.codeText = (time--) + 's后重新获取';
                            if (time < 0) {
                                clearInterval(interval);
                                _this.codeText = '获取验证码';
                                _this.isWaiting = false;
                            }
                        }, 1000)
                    },
                    sumbit() {
                        var _this = this;
                        if(this.is_zh == 1){
                            if (!this.phone) return $cs.msg('请输入手机号');
                        }else{
                            if (!this.phone) return $cs.msg('请输入邮箱');
                        }
                        // if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,18}$/.test(this.dlPassword)) return $cs.msg('请输入密码(6-18位数字、字母组合');
                        if (!this.dlPassword) return $cs.msg('请输入登录密码');
                        if (!this.dlPassword1) return $cs.msg('请再次输入登录密码');
                        if (this.dlPassword != this.dlPassword1) return $cs.msg('登录密码不一致');
                        if (!this.jyPassword) return $cs.msg('请输入交易密码');
                        if (!this.jyPassword1) return $cs.msg('请再次输入交易密码');
                        if (this.jyPassword != this.jyPassword1) return $cs.msg('交易密码不一致');
                        if (!this.code) return $cs.msg('请输入短信验证码');
                        if (!this.invite) return $cs.msg('请输入邀请码');
                        if(this.is_zh == 1){
                            var params = {
                                phone: this.phone,
                                verify_code: this.code,
                                invite_code: this.invite,
                                password: this.dlPassword,
                                password1: this.dlPassword1,
                                pay_password: this.jyPassword,
                                pay_password1: this.jyPassword1,
                            };
                            if (this.on_disable) return;
                            this.on_disable = true;
                            $cs.ajax('login/register',params, function (ret) {
                                if (ret.success == true) {
                                    $cs.msg('注册成功');
                                    window.location = "http://dxdonwload.ifc005.com/";
                                } else {
                                    _this.on_disable = false;
                                    $cs.msg(ret.message);
                                }
                            });
                        }else{
                            var params = {
                                email: this.phone,
                                verify_code: this.code,
                                invite_code: this.invite,
                                password: this.dlPassword,
                                password1: this.dlPassword1,
                                pay_password: this.jyPassword,
                                pay_password1: this.jyPassword1,
                            };
                            if (this.on_disable) return;
                            this.on_disable = true;
                            $cs.ajax('login/emailRegister',params, function (ret) {
                                if (ret.success == true) {
                                    $cs.msg('注册成功');
                                    window.location = "http://dxdonwload.ifc005.com/";
                                } else {
                                    _this.on_disable = false;
                                    $cs.msg(ret.message);
                                }
                            });
                        }
                    },
                    goxzdz(){
                        window.location = "http://dxdonwload.ifc005.com/";
                    },
                },
            })
        }
    </script>
</body>

</html>